
Problems with rspec stories
Reported by SideBurns | August 14th, 2008 @ 10:46 AM
I just installed the newest version of restful authen. a couple of days ago, however, I am getting some problems with the stories. Here is the error:
FAILURES:
1) Creating an account (Anonymous user can not create an account replacing an activated account) FAILED
Spec::Expectations::ExpectationNotMetError: expected "2008-08-14 15:44:22 UTC", got "2008-08-14 15:44:17 UTC" (using .eql?)
/Users/steve/dev/ra/stories/steps/ra_resource_steps.rb:110:in `(?-mix:the $resource\'s $attribute should stay the same(?: under $func)?)'
stories/all.rb:2
Any ideas?
Comments and changes to this ticket
-
mrflip August 14th, 2008 @ 12:23 PM
- State changed from new to open
This is testing whether the account has changed -- if I try to sign up as flip and there is already a user "flip" then nothing should change in the "flip" instance, and thus its updated_at time shouldn't have changed. I don't know if there's a better way to do this from the stories.
Can you check your logs and see whether the model is, indeed, being updated? (look for SQL like UPDATE "users" SET ...stuff... in the test log). Also, try commenting out the lines
And the <%= file_name %>'s created_at should stay the same under to_s And the <%= file_name %>'s updated_at should stay the same under to_s
I'll see if I can reproduce this, too.
-
SideBurns August 14th, 2008 @ 11:53 PM
Ok, I have removed all the stories but the one causing the problem. Here is the test log from that one story:
Processing SessionsController#destroy (for 127.0.0.1 at 2008-08-14 22:44:26) [GET] Session ID: f0b3b58c536d95b14520dfb129d4d3f1 Parameters: {"action"=>"destroy", "controller"=>"sessions"} Cookie set: auth_token=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT Redirected to http://www.example.com/ Completed in 0.12036 (8 reqs/sec) | DB: 0.00000 (0%) | 302 Found [http://www.example.com/sessions/...]
Processing SiteController#index (for 127.0.0.1 at 2008-08-14 22:44:27) [GET] Session ID: BAh7BzoOcmV0dXJuX3RvMCIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6 Rmxhc2g6OkZsYXNoSGFzaHsGOgtub3RpY2UiHllvdSBoYXZlIGJlZW4gbG9n Z2VkIG91dC4GOgpAdXNlZHsGOwdG--80c6475f80c1e05e9ad668feff5d79708144eb11 Parameters: {"action"=>"index", "controller"=>"site", "view"=>"index"} Rendering template within layouts/application Rendering site/index Completed in 0.00581 (172 reqs/sec) | Rendering: 0.00254 (43%) | DB: 0.00000 (0%) | 200 OK [http://www.example.com/]
Processing UsersController#create (for 127.0.0.1 at 2008-08-14 22:44:27) [POST] Session ID: BAh7BzoOcmV0dXJuX3RvMCIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6 Rmxhc2g6OkZsYXNoSGFzaHsGOgtub3RpY2UiHllvdSBoYXZlIGJlZW4gbG9n Z2VkIG91dC4GOgpAdXNlZHsGOwdU--226028eaf45a5d2cd5ecc5c42c33032541c8ccc8 Parameters: {"user"=>{"password_confirmation"=>"monkey", "password"=>"monkey", "login"=>"reggie", "email"=>"registered@example.com"}, "action"=>"create", "controller"=>"users"} Cookie set: auth_token=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT SQL (0.000223) SELECT "login" FROM "users" WHERE (LOWER("users".login) = 'reggie') SQL (0.000110) SELECT "email" FROM "users" WHERE (LOWER("users".email) = 'registered@example.com') User Create (0.000676) INSERT INTO "users" ("name", "salt", "updated_at", "activated_at", "crypted_password", "deleted_at", "remember_token_expires_at", "activation_code", "remember_token", "login", "email", "created_at", "state") VALUES('', 'e459ac0775e603269570852a49f25232ef27a3bf', '2008-08-15 04:44:27', NULL, '4af9bc952e7c5d796e05fe7f4467b7f916a2d16a', NULL, NULL, 'b3dd00927d1cc8dee8c251412cb66ffce56564fa', NULL, 'reggie', 'registered@example.com', '2008-08-15 04:44:27', 'pending') Sent mail to registered@example.com
Date: Thu, 14 Aug 2008 22:44:27 -0600 From: ADMINEMAIL To: registered@example.com Subject: [YOURSITE] Please activate your new account Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8
Your account has been created.
Username: reggie Password: monkey
Visit this url to activate your account:
http://YOURSITE/activate/b3dd009... SQL (0.000228) SELECT "login" FROM "users" WHERE (LOWER("users".login) = 'reggie' AND "users".id <> 4) SQL (0.000135) SELECT "email" FROM "users" WHERE (LOWER("users".email) = 'registered@example.com' AND "users".id <> 4) Redirected to http://www.example.com/ Completed in 3.38659 (0 reqs/sec) | DB: 0.00137 (0%) | 302 Found [http://www.example.com/users] User Load (0.000551) SELECT * FROM "users" WHERE ("users"."login" = 'reggie') LIMIT 1
Processing SiteController#index (for 127.0.0.1 at 2008-08-14 22:44:30) [GET] Session ID: BAh7CDoOcmV0dXJuX3RvMDoMdXNlcl9pZDAiCmZsYXNoSUM6J0FjdGlvbkNv bnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhhc2h7BjoLbm90aWNlIlJUaGFua3Mg Zm9yIHNpZ25pbmcgdXAhICBXZSdyZSBzZW5kaW5nIHlvdSBhbiBlbWFpbCB3 aXRoIHlvdXIgYWN0aXZhdGlvbiBjb2RlLgY6CkB1c2VkewY7CEY=--c88d887c8fded485ffc7af6b19bb78f8d7f042ee Parameters: {"action"=>"index", "controller"=>"site", "view"=>"index"} Rendering template within layouts/application Rendering site/index Completed in 0.00097 (1028 reqs/sec) | Rendering: 0.00084 (86%) | DB: 0.00055 (56%) | 200 OK [http://www.example.com/]
Processing UsersController#activate (for 127.0.0.1 at 2008-08-14 22:44:30) [GET] Session ID: BAh7CDoOcmV0dXJuX3RvMDoMdXNlcl9pZDAiCmZsYXNoSUM6J0FjdGlvbkNv bnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhhc2h7BjoLbm90aWNlIlJUaGFua3Mg Zm9yIHNpZ25pbmcgdXAhICBXZSdyZSBzZW5kaW5nIHlvdSBhbiBlbWFpbCB3 aXRoIHlvdXIgYWN0aXZhdGlvbiBjb2RlLgY6CkB1c2VkewY7CFQ=--0b28e00831474063f2b6ee39a9a2a8cd11036080 Parameters: {"activation_code"=>"b3dd00927d1cc8dee8c251412cb66ffce56564fa", "action"=>"activate", "controller"=>"users"} Cookie set: auth_token=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT User Load (0.000550) SELECT * FROM "users" WHERE ("users"."activation_code" = 'b3dd00927d1cc8dee8c251412cb66ffce56564fa') LIMIT 1 User Update (0.000184) UPDATE "users" SET "activated_at" = '2008-08-15 04:44:30', "activation_code" = NULL, "state" = 'active', "updated_at" = '2008-08-15 04:44:30' WHERE "id" = 4 Sent mail to registered@example.com
Date: Thu, 14 Aug 2008 22:44:30 -0600 From: ADMINEMAIL To: registered@example.com Subject: [YOURSITE] Your account has been activated! Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8
reggie, your account has been activated. Welcome aboard!
http://YOURSITE/ Redirected to http://www.example.com/login Completed in 3.03931 (0 reqs/sec) | DB: 0.00073 (0%) | 302 Found [http://www.example.com/activate/...]
Processing SessionsController#new (for 127.0.0.1 at 2008-08-14 22:44:33) [GET] Session ID: BAh7CDoOcmV0dXJuX3RvMDoMdXNlcl9pZDAiCmZsYXNoSUM6J0FjdGlvbkNv bnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhhc2h7BjoLbm90aWNlIjFTaWdudXAg Y29tcGxldGUhIFBsZWFzZSBzaWduIGluIHRvIGNvbnRpbnVlLgY6CkB1c2Vk ewY7CEY=--aa231e6c185b9d5f403fb44c5e9a44cec15f7993 Parameters: {"action"=>"new", "controller"=>"sessions"} Rendering template within layouts/application Rendering sessions/new Completed in 0.00329 (303 reqs/sec) | Rendering: 0.00311 (94%) | DB: 0.00000 (0%) | 200 OK [http://www.example.com/login]
Processing UsersController#create (for 127.0.0.1 at 2008-08-14 22:44:33) [POST] Session ID: BAh7CDoOcmV0dXJuX3RvMDoMdXNlcl9pZDAiCmZsYXNoSUM6J0FjdGlvbkNv bnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhhc2h7BjoLbm90aWNlIjFTaWdudXAg Y29tcGxldGUhIFBsZWFzZSBzaWduIGluIHRvIGNvbnRpbnVlLgY6CkB1c2Vk ewY7CFQ=--7330e5240ab12e0aebb6d29196b900568a1d1663 Parameters: {"user"=>{"login"=>"reggie", "password"=>"monkey", "email"=>"reggie@example.com"}, "action"=>"create", "controller"=>"users"} Cookie set: auth_token=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT SQL (0.000292) SELECT "login" FROM "users" WHERE (LOWER("users".login) = 'reggie') SQL (0.000146) SELECT "email" FROM "users" WHERE (LOWER("users".email) = 'reggie@example.com') SQL (0.000197) SELECT "login" FROM "users" WHERE (LOWER("users".login) = 'reggie') SQL (0.000107) SELECT "email" FROM "users" WHERE (LOWER("users".email) = 'reggie@example.com') Rendering template within layouts/application Rendering users/new Completed in 0.00807 (123 reqs/sec) | Rendering: 0.00382 (47%) | DB: 0.00074 (9%) | 200 OK [http://www.example.com/users] User Load (0.000529) SELECT * FROM "users" WHERE ("users"."login" = 'reggie') LIMIT 1 User Load (0.000541) SELECT * FROM "users" WHERE ("users"."login" = 'reggie') LIMIT 1
And the error it produced is: FAILURES:
1) Creating an account (Anonymous user can not create an account replacing an activated account) FAILED Spec::Expectations::ExpectationNotMetError: expected "2008-08-15 04:44:30 UTC", got "2008-08-15 04:44:27 UTC" (using .eql?) ./stories/steps/ra_resource_steps.rb:111:in `(?-mix:the $resource\'s $attribute should stay the same(?: under $func)?)'
stories/rest_auth_stories.rb:17
So it looks to me, that when the user was first created, it created it with 04:44:27. However, when the user gets activated it got changed to 04:44:30. However, the comparison returned the first value (27), so it was like the update didn't work. If I am reading this right...
-
SideBurns August 22nd, 2008 @ 09:03 AM
I think I have resolved the issue. I decided to fix some of the other specs that I had that were failing. After fixing them, it seems now to work??
Thanks for the help.
-
mrflip August 22nd, 2008 @ 01:07 PM
- State changed from open to resolved
- Tag set to account, activation, rspec, stories, testing, user, validation
Cool -- closing this, unless someone else runs into it.
Were the failing specs "your" fault or restful_authentication's fault?
-
SideBurns August 22nd, 2008 @ 01:39 PM
It must have been my fault if you have been unable to duplicate the prob.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
Restful Authentication Generator
This widely-used plugin provides a foundation for securely managing user
authentication:
* Login / logout
* Secure password handling
* Account activation by validating email
* Account approval / disabling by admin
* Rudimentary hooks for authorization and access control.
http://github.com/technoweenie/restful-authentication/tree
Referenced by
-
10 uninitialized constant Authorization::AasmRoles::AASM (NameError) Installed the rubyist-aasm gem following the instructions...